package com.NetSunWeiQin.chapter11.demo;

import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class ServerDemo {


    public static void main(String[] args) throws RemoteException, AlreadyBoundException {


        IRemoteObj remote = new IRemoteImpl();

        LocateRegistry.createRegistry(1099);

        Registry registry = LocateRegistry.getRegistry();

        registry.bind("remote", remote);

        System.out.println(" INFO  Server is ok");

        //UnicastRemoteObject.unexportObject(remoteMath, false); 设置对象不可被调用
        // 当然也可以通过java.rmi.Naming以键值对的形式来将服务命名进行绑定
    }
}
